#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <assert.h>
#include <math.h>
#include "tw2865.h"

int main()
{
	int dev;
	//struct tw2865_reg twreg;
	unsigned int buf[8192];
	int length = 0;

	dev = open("/dev/tw2865dev", O_RDWR);
	if (dev <= 0) {
		printf("tw2865dev device open fail\n");
		exit(0);
	}

	memset(buf, '\0', sizeof(buf));
	while (1) {
		length = read(dev, buf, 8192);
		printf("read length is %d\n", length);
		if (length > 0 || length == 8192) {
			write(dev, buf, length);
		}
		memset(buf, '\0', sizeof(buf));
	}
	
	close(dev);

	return 0;
}

/*
 arm-hisi-linux-gcc  -o app app-tw2865.c
 */
